/*访问后台的代码*/
layui.define([], function (exports) {
    var api = {
        saveForm: function (isNew, form, callback) {
            var postUrl = "/customer/customerInfo/update.json";
            if (isNew) {
                postUrl = "/customer/customerInfo/add.json";
            }
            Lib.submitFileForm(postUrl, form, {}, callback)
        },
        saveExam: function (form, callback) {
            var postUrl = "/customer/customerInfo/exam.json";
            Lib.submitFileForm(postUrl, form, {}, callback)
        },
        grantForm: function (form,callback) {
            var postUrl = "/customer/customerInfo/grant.json";
            Lib.submitTradForm(postUrl, form,{}, callback)
        },
        grantCustomerForm: function (form, callback) {
            var postUrl = "/customer/customerInfo/grantCustomer.json";
            Lib.submitFileForm(postUrl, form, {}, callback)
        },
        revoke: function (form,callback) { // 收回授权
           var postUrl = "/customer/customerInfo/revoke.json";
            Lib.submitFileForm(postUrl, form, {}, callback)
        },
        saveEmp: function (form, callback) {
            if (form[0].userId.value == "") {
                Common.info("必须选择对应员工");
                return;
            }
            var postUrl = "/customer/customerInfo/emp.json";
            Lib.submitFileForm(postUrl, form, {}, callback)
        },
        del: function (ids, callback) {
            Common.post("/customer/customerInfo/delete.json", {"ids": ids}, function () {
                callback();
            })
        }

    };
    exports('customerInfoApi', api);
});